SCORE_ADD:
	LDX #$00
	; 8 pixel mask
	LDA #@00001111
	BIT VAR_SCREEN_SCROLL_X
	BEQ SCORE_ADD_BEGIN
	RTS

SCORE_ADD_BEGIN:
	INC VAR_SCORE,x
	LDA VAR_SCORE,x
	; ADC #$01
	CMP #$0A
	BCS SCORE_GREAT_THAN_10
	JMP SCORE_ADD_END
SCORE_GREAT_THAN_10:
	SBC #$0A
	STA VAR_SCORE,x
	INX
	CPX #$05
	BEQ SCORE_ADD_END
	JMP SCORE_ADD_BEGIN

SCORE_ADD_END:
	STA VAR_SCORE,x
	RTS


SCORE_COPY_TO_HIGH:
	; check should replace the high socore
	LDX #$04
.Loop
	LDA VAR_SCORE,x
	CMP VAR_SCORE_HI,x
	BCC SCORE_COPY_TO_HIGH_END
	DEX
	CPX #$FF
	BNE .Loop


SCORE_COPY_TO_HIGH_BEGIN
	; copy current score to high score
	LDX #$00
.Loop2
	LDA VAR_SCORE,x
	STA VAR_SCORE_HI,x
	INX
	CPX #$05
	BNE .Loop2

SCORE_COPY_TO_HIGH_END:
	RTS
